#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>

int main() {
	char name[L_tmpnam], line[1024];
	FILE* fp;

	printf("%s\n", tmpnam(NULL));
	tmpnam(name);
	printf("%s\n", name);

	if ((fp=tmpfile()) == NULL) {
		printf("tmpfile error: %s\n", strerror(errno));
		return -1;
	}

	fputs("one line of output\n", fp);
	rewind(fp);
	if (fgets(line, sizeof(line), fp) == NULL) {
		printf("fgets error: %s\n", strerror(errno));
		return -1;
	}
	fputs(line, stdout);

	printf("%s\n", tempnam("/home/windy/", "XYZ"));

	int ret = printf("");
	printf("%d\n", ret);
	return 0;
}